//此程序用来利用PWM端口来输出相应的电压值，可以定量控制，来推处PWM端口数值与风扇转速的函数关系
int inputPin = A0;//测速信号读取
int outputPin = 9;
//int inputPin = 11;
//测速线连接上拉电阻1~100K连接inputPin
//建议使用串口通讯来找到具体数值
void setup() {
  // put your setup code here, to run once:
  pinMode(inputPin,INPUT);
  pinMode(outputPin,OUTPUT);
  Serial.begin(9600);//可调
}

void loop() {
  // put your main code here, to run repeatedly:
  int delaytime = 50;
  for(int i=0;i<=1023;i+=10)
  {
  analogWrite(outputPin,i);
  delay(delaytime);
  analogRead(inputPin);
  Serial.println(inputPin);
  delay(delaytime);//控制转速的电压不会突然变化，可以调大间隔数值
  }
}
